package com.bacel.nb.product.core.domain;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by Administrator on 2017/8/30 0030.
 */
@Entity
public class Sysroleright {
    private Integer id;
    private Timestamp createdate;
    private Integer roleid;
    private Sysrole sysroleByRoleid;
    private Integer moduleid;
    private Sysmodule sysmoduleByModuleid;
    private Integer rightid;
    private Sysright sysrightByRightid;

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "createdate", nullable = true)
    public Timestamp getCreatedate() {
        return createdate;
    }

    public void setCreatedate(Timestamp createdate) {
        this.createdate = createdate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Sysroleright that = (Sysroleright) o;

        if (id != that.id) return false;
        if (createdate != null ? !createdate.equals(that.createdate) : that.createdate != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (createdate != null ? createdate.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "roleid", referencedColumnName = "id", foreignKey = @ForeignKey(name = "sysroleright_ibfk_1"))
    public Sysrole getSysroleByRoleid() {
        return sysroleByRoleid;
    }

    public void setSysroleByRoleid(Sysrole sysroleByRoleid) {
        this.sysroleByRoleid = sysroleByRoleid;
    }

    @ManyToOne
    @JoinColumn(name = "moduleid", referencedColumnName = "id", foreignKey = @ForeignKey(name = "sysroleright_ibfk_2"))
    public Sysmodule getSysmoduleByModuleid() {
        return sysmoduleByModuleid;
    }

    public void setSysmoduleByModuleid(Sysmodule sysmoduleByModuleid) {
        this.sysmoduleByModuleid = sysmoduleByModuleid;
    }

    @ManyToOne
    @JoinColumn(name = "rightid", referencedColumnName = "id", foreignKey = @ForeignKey(name = "sysroleright_ibfk_3"))
    public Sysright getSysrightByRightid() {
        return sysrightByRightid;
    }

    public void setSysrightByRightid(Sysright sysrightByRightid) {
        this.sysrightByRightid = sysrightByRightid;
    }

    @Column(name = "roleid", insertable = false, updatable = false)
    public Integer getRoleid() {
        return roleid;
    }

    public void setRoleid(Integer roleid) {
        this.roleid = roleid;
    }

    @Column(name = "moduleid", insertable = false, updatable = false)
    public Integer getModuleid() {
        return moduleid;
    }

    public void setModuleid(Integer moduleid) {
        this.moduleid = moduleid;
    }

    @Column(name = "rightid", insertable = false, updatable = false)
    public Integer getRightid() {
        return rightid;
    }

    public void setRightid(Integer rightid) {
        this.rightid = rightid;
    }
}
